package cn.itcast.zt.java8.mapstruct.objobj;

import cn.itcast.zt.java8.mapstruct.BaseMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * create by zhangtian105 on 2021/7/28
 */
@Mapper
public interface CDMapping extends BaseMapping<C, D> {
    @Mappings({
            @Mapping(target = "idCard", source = "id"),
            @Mapping(target = "username", source = "name"),
            @Mapping(target = "dd.idCard", source = "cc.id"),
            @Mapping(target = "dd.username", source = "cc.name")
    })
    // 对象嵌套可以这么搞，嵌套多层就多层.处理
    D sourceToTarget(C c);
}
